﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManageUserInfo.aspx.cs" Inherits="ManageUserInfo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>员工信息管理</title>
</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align: center">
        <br />
        <asp:TreeView ID="TreeView1" runat="server" ImageSet="BulletedList" ShowExpandCollapse="False">
            <ParentNodeStyle Font-Bold="False" />
            <HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
            <SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" HorizontalPadding="0px"
                VerticalPadding="0px" />
            <Nodes>
                <asp:TreeNode NavigateUrl="~/WebUI/ManageCustomersInfo.aspx" Text="前往注册用户管理界面" Value="前往注册用户管理界面">
                </asp:TreeNode>
                <asp:TreeNode NavigateUrl="~/WebUI/ManageStrategy.aspx" Text="前往策略管理界面" Value="前往策略管理界面">
                </asp:TreeNode>
            </Nodes>
            <NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="0px"
                NodeSpacing="0px" VerticalPadding="0px" />
        </asp:TreeView>
        &nbsp;<br />
        <br />
        &nbsp;员工信息管理：<asp:GridView ID="GridView1" runat="server" 
            OnRowCancelingEdit="GridView1_RowCancelingEdit" 
            OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing" 
            OnRowUpdating="GridView1_RowUpdating1" AutoGenerateColumns="False" 
            CaptionAlign="Top" HorizontalAlign="Center" AllowPaging="True" 
            DataKeyNames="StaffID" DataSourceID="StaffAllSqlSource" Width="590px" >
            <Columns>
                <asp:BoundField DataField="StaffID" HeaderText="员工ID" ReadOnly="True" 
                    SortExpression="StaffID" />
                <asp:BoundField DataField="Name" HeaderText="姓名" SortExpression="Name" />
                <asp:BoundField DataField="Department" HeaderText="部门" 
                    SortExpression="Department" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Psw" HeaderText="密码" SortExpression="Psw" />
                <asp:CommandField HeaderText="编辑" 
                    ShowEditButton="True" ShowHeader="True" UpdateText="保存" />
                <asp:CommandField HeaderText="删除" ShowDeleteButton="True" 
                    ShowHeader="True" />
            </Columns>
            <EditRowStyle Wrap="True" />
        </asp:GridView>
        <div style="text-align: justify">
            添加员工信息：<br />
            id:&nbsp;<asp:TextBox ID="idTextBox" runat="server" ></asp:TextBox>
&nbsp;&nbsp; 注意：Id不能重复。<br />
            姓名:<asp:TextBox ID="nameTextBox" runat="server"></asp:TextBox>
            <br />
            部门：<asp:TextBox ID="deTextBox" runat="server"></asp:TextBox>
            <br />
            Email：<asp:TextBox ID="emailTextBox" runat="server"></asp:TextBox>
            <br />
            密码：<asp:TextBox ID="pswTextBox" runat="server" TextMode="Password"></asp:TextBox>
            <br />
            <br />
            <asp:Button ID="AddButton" runat="server" onclick="AddButton_Click" Text="添加" />
        </div>
        <br />
        <br />
        <br />
        &nbsp;<asp:SqlDataSource ID="StaffAllSqlSource" runat="server" 
            ConnectionString="Data Source=localhost;Initial Catalog=webinf;User ID=sa" 
            DeleteCommand="DELETE FROM Staff WHERE (StaffID = @StaffID)" 
            InsertCommand="INSERT INTO Staff(StaffID, Name, Department, Email, Psw) VALUES (@id, @name, @depa, @email, @psw)" 
            SelectCommand="SELECT * FROM [Staff]" 
            UpdateCommand="UPDATE Staff SET Name =@Name, Department =@Department , Email =@Email , Psw =@Psw  WHERE StaffID =@StaffID">
            <InsertParameters>
                <asp:ControlParameter ControlID="idTextBox" DefaultValue="0" Name="id" 
                    PropertyName="Text" />
                <asp:ControlParameter ControlID="nameTextBox" Name="name" PropertyName="Text" DefaultValue="" />
                <asp:ControlParameter ControlID="deTextBox" Name="depa" PropertyName="Text" DefaultValue="" />
                <asp:ControlParameter ControlID="emailTextBox" Name="email" 
                    PropertyName="Text" />
                <asp:ControlParameter ControlID="pswTextBox" Name="psw" PropertyName="Text" />
            </InsertParameters>
        </asp:SqlDataSource>
        </div>
    </form>
</body>
</html>
